﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace for7raid.vkPlayer
{
    public class AlbumIdToTitleConverter: IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var id = (int)values[0];
            var albums = values[1] as ICollection<Album>;
            if (id == 0 || albums == null)
                return "[Общий]";
            var album = albums.FirstOrDefault(a => a.ID == id);
            return album == null ? "[Общий]" : album.Title;

        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
